#!/bin/sh

# mkdir -p ~/usr/lib

export CCHOME=/usr/local/Cellar/llvm/17.0.1
export PATH=$HOME/usr/bin:$HOME/bin:$CCHOME/bin:$PATH
LDFLAGS="-L/usr/local/opt/llvm/lib/c++ -Wl,-rpath,/usr/local/opt/llvm/lib/c++"
CPPFLAGS="-I$CCHOME/include"
export LD_LIBRARY_PATH=~/usr/lib
export DYLD_LIBRARY_PATH=~/usr/lib

#
# Build mtrader and shmem
#
# cd ~/projects/mns
# #
# # !!! EDIT the MU !!! in CMakeLists.txt-macos
# #
# cp CMakeLists.txt-macos CMakeLists.txt
# sh scripts/cmake-cmd.sh
# cd release && make -j install
# #
# # uncompress data
# #
# mkdir ~/projects/data
# cd ~/projects/data
# rm -f *
# cp ~/projects/mns/data/* ./
# xz -d *.xz

#
# install mnsui to $HOME/usr/bin
#
# cd ~/projects/mnsui
# #
# # !!! EDIT the MU !!! in CMakeLists.txt-macos
# # !!! EDIT Qt6_PATH !!! in CMkaeLists.txt-macos
# #
# cp CMakeLists.txt-macos CMakeLists.txt
# sh scripts/cmake-cmd.sh
# cp -rf ~/projects/mnsui/release/mnsui.app/Contents/MacOS/mnsui ~/usr/bin/
# cp -rf ~/projects/mnsui/images ~/usr/bin/
#

mk=my-mem-key

shmem $mk ~/projects/data/hb-tick-202312-202401.bin ~/projects/data/dumperd.bin &

sleep 6

cd ~/usr/bin
./mnsui $mk 4570000 &

sleep 2

mtrader $mk 4570000 step

